package com.bckj.fastboot.core.page;

import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * Page线程变量，只允许当前包中访问，避免滥用导致内存泄露
 */
class PageContext {

    private static final ThreadLocal<IPage<?>> PAGE_THREAD_LOCAL = new ThreadLocal<>();

    static void setPage(IPage<?> page) {
        PAGE_THREAD_LOCAL.set(page);
    }

    static IPage<?> getPage() {
        return PAGE_THREAD_LOCAL.get();
    }


    static void remove() {
        PAGE_THREAD_LOCAL.remove();
    }
}
